//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Example #15—StringBuffer Class Example
// CS 151, 6 Apr 2009
// ECC, Spring 2009
// Niko Culevski
// Program to demonstrate the StringBuffer class
// The StringBuffer is superior to the String class and
// should be used in lieu of the String class whenever possible
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public class TestAppending
{
    public static void main(String[] args)
    {
        StringBuffer buf = new StringBuffer(10);
        buf.append("It was");
        System.out.println("buf = " + buf);
        System.out.println("buf.length() = " + buf.length());
        System.out.println("buf.capacity() = " + buf.capacity());
        buf.append(" the best");
        System.out.println("buf = " + buf);
        System.out.println("buf.length() = " + buf.length());
        System.out.println("buf.capacity() = " + buf.capacity());
        buf.append(" of times.");
        System.out.println("buf = " + buf);
        System.out.println("buf.length() = " + buf.length());
        System.out.println("buf.capacity() = " + buf.capacity());
  }
}
